package org.argeproje.resim.ui.component.datasources;

import org.argeproje.resim.proc.input.ImageInputPR;
import org.argeproje.resim.property.FileSelectPRP;
import org.argeproje.resim.ui.model.ComponentItem;


public class ImageInputCI extends ComponentItem {

	private static final long serialVersionUID = 1;
	private static final String IMG_PATH_PROP = "FileImage.Path";	
	
	private String _imageFilePath;
	
	public ImageInputCI()
	{		
		super();
		_name = "Image\nInput";
		_description = "Image input from file";
		initProc();
	}
	
	public void setImageFilePath(String path)
	{
		_imageFilePath = path;
	}
	
	public String getImageFilePath()
	{
		return _imageFilePath;
	}
	
	protected void initDescriptorList()
	{
		super.initDescriptorList();
		registerProperty(new FileSelectPRP(this,IMG_PATH_PROP,"Path","getImageFilePath","setImageFilePath"));
	}

	public Class<ImageInputCI> getComponentClass() {
		return ImageInputCI.class;
	}

	public void initProc(){
		if(_processor == null)
		{
			_processor = new ImageInputPR();			
		}
		this._imageFilePath = "";
	}
	
	public void updateProc() {
		if(_processor == null)
		{
			_processor = new ImageInputPR();			
		}
		((ImageInputPR)_processor).setParameters(_imageFilePath);
	}

}
